package com.hubei.tools;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @author PJM
 * @date 2025/6/24-10:20
 */
public class JDBCTool {

    public static Connection getConnection() throws Exception{
        // 加载第三方mysql的驱动类
        Class.forName("com.mysql.cj.jdbc.Driver");
        String username = "root";
        String password = "123456";
        String url = "jdbc:mysql://127.0.0.1:3306/test?characterEncoding=UTF-8&useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true";
        Connection conn = DriverManager.getConnection(url, username, password);
        return conn;
    }

}
